home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Hyper / Q-R / QuickTurtle.cpt / QuickTurtle / QuickTurtle.rsrc / STR#_100.txt < prev    next >
Encoding:
Text File  |  1991-06-27  |  2.6 KB  |  104 lines

  1. The first line of a program names it as:
  2.  
  3.   Program <programName>
  4.  
  5. The same name must be assigned to the ‚Äúmain‚Äù procedure of the program (the procedure that is called when the program is run).
  6.  
  7. The first line of each procedure is:
  8.  
  9.   on <procedureName [paramList]>
  10.  
  11. Up to 9 variable parameters can be listed, separated by commas.
  12.  
  13. A procedure ends with the line:
  14.  
  15.   end <procedureName>
  16.  
  17. The exit command causes the program to exit the currently executing procedure.  The procedure must be named:
  18.  
  19.   exit <procedureName>
  20.  
  21. The simplest type of conditional statement takes the form:
  22.  
  23.   if <condition> then <action>
  24.  
  25. all on one line.  ‚Äúcondition‚Äù represents any boolean expression (i.e., one that evaluates to ‚Äútrue‚Äù or ‚Äúfalse‚Äù).
  26.  
  27. A compound if statement takes the form:
  28.  
  29.    if <condition> then
  30.      <series of one or more actions>
  31.    end if
  32.  
  33. An if-then-else statement can take the form:
  34.  
  35.   if <condition> then <action>
  36.   else <action>
  37.  
  38. or the form:
  39.  
  40.   if <condition> then
  41.     <series of one or more actions>
  42.   else <action>
  43.  
  44. If-then-else-end if statements take the form:
  45.  
  46.    if <condition> then <action>
  47.    else
  48.      <series of one or more actions>
  49.    end if
  50.  
  51. or:
  52.  
  53.    if <condition> then
  54.      <series of one or more actions>
  55.    else
  56.      <series of one or more actions>
  57.    end if
  58.  
  59. The repeat command takes the form:
  60.  
  61.   repeat
  62.     <series of one or more actions>
  63.   end repeat
  64.  
  65. This repeats ‚Äúendlessly‚Äù unless there is an exit command in the repeat loop (or until the mouse is clicked stopping the program).
  66.  
  67. The repeat-for command takes the form:
  68.  
  69.   repeat [for] <expr> [times]
  70.    <series of one or more actions>
  71.   end repeat
  72.  
  73. The words in square brackets are optional; ‚Äúexpr‚Äù = number, variable, or mathematical expression.
  74.  
  75. The repeat-until command takes the form:
  76.  
  77.   repeat until <boolean expr>
  78.     <series of one or more actions>
  79.   end repeat
  80.  
  81. The loop repeats until the boolean expression evaluates to true.
  82.  
  83. The repeat-while command takes the form:
  84.  
  85.   repeat while <boolean expr>
  86.     <series of one or more actions>
  87.   end repeat
  88.  
  89. The loop repeats until the boolean expression evaluates to false.
  90.  
  91. The repeat-with command takes the form:
  92.  
  93.   repeat with <variable> = <expr> to <expr>
  94.    <series of one or more actions>
  95.   end repeat
  96.  
  97.  
  98. The variable is assigned the value of the first expression, and then incremented (or decremented, if ‚Äúdownto‚Äù is used instead of ‚Äúto‚Äù) by 1 with each loop, until it reaches the value of the second expression.
  99.  
  100. The ‚Äúnext repeat‚Äù command must occur within a repeat loop. It brings the program back to the beginning of the loop.
  101.  
  102. The ‚Äúexit repeat‚Äù command must occur within a repeat loop.  It causes the program to exit the loop.
  103.  
  104.